from selenium.webdriver.common.by  import By
from page.base_page import BasePage

class AddProductPage(BasePage):
    url="/crm5/index.php?m=product&a=add"
    product_name_locator = (By.ID, "name")
    development_team_locator = (By.ID, "development_team")
    add_image_locator = (By.ID, "main_pic")
    new_add_Secondary_image_locator = (By.ID, "btn_add_files")
    add_Secondary_image_locator = (By.ID, "sec_pic_1")
    btn_save_locator = (By.CSS_SELECTOR, "#form1 > table > tfoot > tr > td > input:nth-child(1)")
    def input_product_name(self,product_name):
        self.driver.find_element(*self.product_name_locator).send_keys(product_name)
    def input_development_team(self,development_team):
        self.driver.find_element(*self.development_team_locator).send_keys(development_team)
    def add_image(self,image):
        self.driver.find_element(*self.add_image_locator).send_keys(image)
    def click_new_add(self):
        self.driver.find_element(*self.new_add_Secondary_image_locator).click()
    def add_secondary_image(self,secondary_image):
        self.driver.find_element(*self.add_Secondary_image_locator).send_keys(secondary_image)
    def click_add_save(self):
        self.driver.find_element(*self.btn_save_locator).click()